package com.zephyr.vchcenter.service.thread;

import java.util.LinkedHashMap;
import java.util.Map;

public class ThreadPoolManager {

	private static ThreadPoolManager instance = null;
	private static Map<String,ThreadManager> pools = null;
	
	public static synchronized ThreadPoolManager getInstance() {
		if (instance == null)
			instance = new ThreadPoolManager();
		if (pools == null)
			pools = new LinkedHashMap<String, ThreadManager>();
		return instance;
	}

	 public static synchronized ThreadManager getThreadManager(String subno){
		 ThreadManager tm = pools.get(subno);
		 if (tm == null){
			 System.out.println("tm not exists.. create new tm..");
			 tm = new ThreadManager();
			 pools.put(subno, tm);
		 } else {
			 System.out.println("tm exists.. return tm..");
		 }
		 return tm;
	 }
}
